<template>
  <div id="card">
    <header>
      <img class="avatar" :src="avatar" :alt="name">
      <p class="name">{{ name }}</p>
    </header>
    <footer>
      <input v-model="$store.state.chat.filterKey" class="search" type="text" placeholder="search user...">
    </footer>
  </div>
</template>

<script>
import { mapGetters } from 'vuex'

export default {
  name: 'Card',
  data() {
    return {

    }
  },
  computed: {
    ...mapGetters([
      'name',
      'avatar'
    ])
  }
}
</script>

<style lang="scss" scoped>
#card {
  padding: 10px;

  .avatar {
    width: 40px;
    height: 40px;
    /* 这个是图片和文字居中对齐 */
    vertical-align: middle;
  }

  .name {
    display: inline-block;
    padding: 10px;
    margin-bottom: 15px;
    font-size: 16px;
  }

  .search {
    background: #26292E;
    height: 30px;
    line-height: 30px;
    padding: 0 10px;
    border: 1px solid #3A3A3A;
    border-radius: 4px;
    /* 鼠标点击后不会出现蓝色边框 */
    outline: none;
    color: #FFF;
  }
}
</style>
